#include <stdio.h>

int narcissistic(int number);
void PrintN(int m, int n);

int main()
{
    int m, n;

    scanf("%d %d", &m, &n);
    if (narcissistic(m))
        printf("%d is a narcissistic number\n", m);
    PrintN(m, n);
    if (narcissistic(n))
        printf("%d is a narcissistic number\n", n);

    return 0;
}

/* 你的代码将被嵌在这里 */
int narcissistic(int number)
{
    int N = 0, temp = number;
    while (temp)
    {
        temp /= 10;
        N++;
    }
    temp = number;
    int sum = 0;
    while (temp)
    {
        sum += pow(temp % 10, N);
        temp /= 10;
    }
    if (number == sum)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
void PrintN(int m, int n)
{

    for (int i = m + 1; i < n; i++)
    {
        if (narcissistic(i) == 1)
        {
            printf("%d\n", i);
        }
    }
}